<h2>Products</h2>

<div *ngFor="let product of products; index as productId">
  <h3>
    <a
      [title]="product.name + ' details'"
      [routerLink]="['/products', productId]"
    >
      {{ product.name }}
    </a>
  </h3>

  <p *ngIf="product.description">Description: {{ product.description }}</p>

  <button (click)="share()">Share</button>

  <!-- 使用组件app-product-alert
       通过属性绑定把当前商品作为输入传给组件
  -->
  <app-product-alerts [product]="product" (notify)="onNotify()">
  </app-product-alerts>
</div>
